package com.jhh.pay.center.actor;

import com.jhh.pay.center.model.OrderState;
import com.jhh.pay.center.model.TradeState;
import com.jhh.pay.center.search.DocTransformer;
import org.springframework.stereotype.Component;

/**
 * @author tangxd
 * @Description: TODO
 * @date 2017/12/11
 */
@Component
public class TradeStateTransformer implements DocTransformer<TradeState,OrderState> {
    @Override
    public OrderState transform(TradeState state) {
        switch (state) {
            case ERROR:
                return OrderState.ERROR;
            case PROGRESSING:
                return OrderState.PROGRESSING;
            case SUCCESS:
                return OrderState.SUCCESS;
            default:
                return OrderState.INIT;
        }
    }
}
